<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改影片</title>
<link href="html/css/css.css" rel="stylesheet" type="text/css" />
<script Language="JavaScript" src="html/js/functions.js"></script>
<script Language="JavaScript" src="html/js/myjs.js"></script>
<script language="javascript">

//提交验证
function check_submit()
{

		if($('Name').value =='')
		{
			msg_box('您还没有填写影片名哦!');
			$('Name').focus();
			return false;
		}

		
		if($('CategoryID').value =='-1')
		{
			msg_box('您还没有选择分类!');
			//$('categoryid').focus();
			return false;
		}

		$('count').value = allCount;
		$('editcount').value = editCount;
		$('submit').disabled = true;
		$('submit').src = 'html/images/ajax.gif';
		return true;
}

function checkImg()
{
	if($('img_check').checked == true)
	{
		$('img_area').innerHTML = '<input name="Photo" type="text" class="txt" id="Photo" />';
		$('img_text').style.color = '#f00';
		
	}
	else
	{
		$('img_area').innerHTML = '<input name="Photo" type="file" class="txt" id="PhotoFile" />';
		$('img_text').style.color = '#ccc';
	}
}


function getCategory()
{
	$('SubCategoryName').value = '分类载入中...';
	var xmlHandle = $.Ajax.get("index.php?c=ajax&d=getCategory&movieId=[$MovieInfo.Id]",getContent);
}

function getContent(str)
{
	
	var btn = '';
	
	var window_height = (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.offsetHeight;
	var window_width = document.body.scrollWidth;

	var window_height_all = document.body.offsetHeight;
	
	var obj = document.createElement('div');
	obj.setAttribute("id","bg_div");
	obj.style.position = "absolute";
	obj.style.zIndex = "10001";
	obj.style.backgroundColor = "#000";
	obj.style.left = "0px";
	obj.style.top = "0px";
	obj.style.bottom = "0px";
	obj.style.filter = "alpha(opacity=50)";
	obj.style.opacity = 0.5;
	
	obj.style.width = window_width + "px"; 
	obj.style.height = window_height_all + "px";
   
	document.body.appendChild(obj);
	
	var msg_box = document.createElement('div');
	msg_box.setAttribute("id","msg_div");
	msg_box.style.position = "absolute";
	msg_box.className = 'msg';
	msg_box.style.zIndex = "10002";
	msg_box.style.left = ((window_width / 2) - 330) + "px";
	msg_box.style.top = '50px';
	msg_box.style.backgroundColor = "#ffffff";
	msg_box.style.Color = "#000";
	msg_box.innerHTML = str.responseText;
	$('SubCategoryName').value = '[@htmlspecialchars($MovieInfo.SubCategoryName)]';
	document.body.appendChild(msg_box);
	
	var sel=$n("select");
	for(var i=0;i<sel.length;i++){sel[i].style.visibility = "hidden"}
}

function selectCategory()
{
	var con = '';
	var id = '';
	var name = '';
	var chks=document.getElementsByName('CategoryID');
	
	for(i=0;i<chks.length;i++){
		
		var arr = chks[i].value.split("|");
		
		if(chks[i].checked){
			 //con = chks[i].value+','+con;
			 id = arr['0'] + ',' + id;
			 name = arr['1'] + ',' + name;
		}
		

	}
	
	//name = subString(name,0,1); 
	
	$('SubCategoryID').value = id;
	$('SubCategoryName').value = name;
	close_msg_box();
}

function getSpecial()
{
	$('Special').value = '专题载入中...';
	var xmlHandle = $.Ajax.get("index.php?c=ajax&d=getSpecial&movieId=[$MovieInfo.Id]",getSpeciaContent);
}


function getSpeciaContent(str)
{
	
	var btn = '';
	
	var window_height = (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.offsetHeight;
	var window_width = document.body.scrollWidth;

	var window_height_all = document.body.offsetHeight;
	
	var obj = document.createElement('div');
	obj.setAttribute("id","bg_div");
	obj.style.position = "absolute";
	obj.style.zIndex = "10001";
	obj.style.backgroundColor = "#000";
	obj.style.left = "0px";
	obj.style.top = "0px";
	obj.style.bottom = "0px";
	obj.style.filter = "alpha(opacity=50)";
	obj.style.opacity = 0.5;
	
	obj.style.width = window_width + "px"; 
	obj.style.height = window_height_all + "px";
   
	document.body.appendChild(obj);
	
	var msg_box = document.createElement('div');
	msg_box.setAttribute("id","msg_div");
	msg_box.style.position = "absolute";
	msg_box.className = 'msg';
	msg_box.style.zIndex = "10002";
	msg_box.style.left = ((window_width / 2) - 330) + "px";
	msg_box.style.top = '400px';
	msg_box.style.backgroundColor = "#ffffff";
	msg_box.style.Color = "#000";
	msg_box.innerHTML = str.responseText;
	$('Special').value = '[@htmlspecialchars($MovieInfo.Special)]';
	document.body.appendChild(msg_box);

	var sel=$n("select");
	for(var i=0;i<sel.length;i++){sel[i].style.visibility = "hidden"}
}
function selectSpecia()
{
	var con = '';
	var id = '';
	var name = '';
	var chks=document.getElementsByName('Sid');
	
	for(i=0;i<chks.length;i++){
		
		var arr = chks[i].value.split("|");
		
		if(chks[i].checked){
			 //con = chks[i].value+','+con;
			 id = arr['0'] + ',' + id;
			 name = arr['1'] + ',' + name;
		}
		

	}
	
	//name = subString(name,0,1); 
	
	$('SpecialID').value = id;
	$('Special').value = name;
	close_msg_box();
}

//添加剧集部分

function add_line(num)
{
	for(i=0;i<num;i++)
	{
		add_property_line();
	}
}

function add_line(num)
{
	for(i=0;i<num;i++)
	{
		add_property_line();
	}
}

//剧集输入框
var allCount=[$num];
var editCount=1;

function add_property_line()
{

	newRow = property.insertRow(property.rows.length);
	newRow.id = "tdt";
	newRow.ln = allCount;
	
	c1 = newRow.insertCell(0);
	c1html = "<input name='Name_" + allCount + "' type='text' class='in' value='第"+ allCount +"集' style='width:80px;' />\n";
	c1.innerHTML = c1html;
	c1.align = 'left';
	
	c2 = newRow.insertCell(1);
	c1html = "<select name='Server_" + allCount + "'  id='server_" + allCount + "'><option value='0'>默认服务器</option><foreach name="ServerList" key="key" var="var"><option value='[$var.Sid]'>[$var.Name]</option></foreach></select>\n";
	
	
	
	c2.innerHTML = c1html;
	c2.align = 'left';
	
	c3 = newRow.insertCell(2);
	c1html = "<input name='URL_" + allCount + "' type='text' class='in' style='width:400px;'/>\n";
	c3.innerHTML = c1html;
	c3.align = 'left';
	
	c4 = newRow.insertCell(3);
	c1html = "<input name='Top_" + allCount + "' type='text' class='in' style='width:80px;'/>\n";
	c4.innerHTML = c1html;
	c4.align = 'left';
	
	//c2.id = "file_input"+ allCount;
	

	c5=newRow.insertCell(4);
	c1html = "<input type='button' name='btn' value='删除' onclick='del_property_line("+allCount+")' class='btn'>\n";
	c5.innerHTML = c1html;
	c5.align = 'left';
	
	
	$('server_' + allCount).value = $('server').value;
		
	editCount ++;
	allCount++;
}

function del_property_line(count)
{

  for (i=1;i<property.rows.length;i++)
	  {
		if (tdt[i].ln==count)
			property.deleteRow(i);
	  }
	allCount --;
	editCount --;
}

function getMovieList()
{
	var xmlHandle = $.Ajax.get("index.php?c=ajax&d=getMovieList&movieId=[$MovieInfo.Id]",function(x){ $('move_list').innerHTML = x.responseText});
}

function chageorder(id,key)
{
	var xmlHandle = $.Ajax.get("index.php?c=ajax&d=changUrlOrder&id="+ id +"&Top="+$('edit_top_' + key).value,function(x){});
}

//删除URL数据操作

function del_url(id)
{
	ok = confirm("删除内容后将无法恢复，您确定删除么！");
	if(ok)
	{
		var xmlHandle = $.Ajax.get("index.php?c=ajax&d=delUrl&id="+ id,function(x){getMovieList();});
	}

}
</script>
<style type="text/css">
.btn{padding:2px; border:1px solid;margin:3px 0;*padding:4px 5px 1px; border-color:#ddd #666 #666 #ddd; background:#DDD; color:#000; cursor:pointer; }
#old .in{border:1px solid #ccc; height:20px; line-height:20px;}
#property .in{border:1px solid #ccc; height:20px; line-height:20px;}
</style>
</head>

<body>

<if $Msg>
<div id="msg"><img src="html/images/information.gif" width="16" height="16" align="absmiddle" />[$Msg]</div>
</if>

<form action="" method="post" enctype="multipart/form-data" name="form" id="form" style="margin:0px" onsubmit="return check_submit();">
<input type="hidden" name="SubCategoryID" id="SubCategoryID" value="[@htmlspecialchars($MovieInfo.SubCategoryID)]" />
<input type="hidden" name="SpecialID" id="SpecialID" value="[@htmlspecialchars($MovieInfo.SpecialID)]" />
<input name="count" type="hidden" class="in" id="count" />
<input name="editcount" type="hidden" class="in" id="editcount" />
<input name="Id" type="hidden" class="in" id="Id" value="[@htmlspecialchars($MovieInfo.Id)]" />

<div class="form_box">
	<div class="header">
    <img src="html/images/television.png" width="16" height="16" align="absmiddle" />&nbsp;修改影片信息
<if $MovieInfo>
<a href="../?c=movie&d=view&id=[$MovieInfo.Id]" target="_blank" style="color:#f00;">查看 [ [@CsubStr($MovieInfo.Name,0,25)] ] </a>
</if>
    </div>
  <div class="box">
    	<div class="text">
    	影片名:
</div>
        <div class="input">
    		<input name="Name" type="text" id="Name" value="[@htmlspecialchars($MovieInfo.Name)]" />
       	</div>
        <div style="clear:both"></div>
    </div>

    <div class="box">
    	<div class="text">
    	索引关键字:
    	</div>
        <div class="input">
    		<input name="KeyWords" type="text" id="KeyWords" value="[@htmlspecialchars($MovieInfo.KeyWords)]" />
       	</div>
        <div style="clear:both"></div>
    </div>


<div class="box">
    	<div class="text">
    	缩略图:<span id="img_text" style="color:#ccc;">网络地址:<input name="img_check" id="img_check" type="checkbox" value="true" onclick="checkImg();" /></span>
    	</div>
        <div class="input">
    		<span id="img_area"><input name="Photo" type="file" id="PhotoFile"  /></span>
            
            <if $MovieInfo.Photo>
            <a href="../[$MovieInfo.Path][$MovieInfo.Photo]" target="_blank" style=" color:#f00;font-weight:bold;">[图]</a>
            </if>
       	</div>
        <div style="clear:both"></div>
    </div>
<div class="box">
    	<div class="text">
    	类型:
        </div>
        <div class="input">
    		
           <select name="Type" id="Type">
           <foreach name="TypeList" key="key" var="var">
           <option value="[$key]">[$var]</option>
		   </foreach>
           </select>
<script language="javascript">$.Input.getSelect('Type','[$MovieInfo.Type]');</script>
       	</div>
        <div style="clear:both"></div>
    </div>
<div class="box">
    	<div class="text">
    	主分类:
</div>
        <div class="input">
    	<if $CategoryForSelect>
    		<select name="CategoryID" id="CategoryID">
            <option value="-1">请选择分类</option>
            [$CategoryForSelect]
          </select>
           <else>
           <input name="CategoryID" type="hidden" value="-1"  />
          <a href="index.php?c=category&d=showDate"><font color="#FF0000"><strong>暂无分类，不能添加数据，点击这里添加新的分类</strong></font></a>          
          </if>附加分类：<input name="SubCategoryName" type="text" id="SubCategoryName" style="width:46%" onclick="getCategory();" readonly="readonly" value="[@htmlspecialchars($MovieInfo.SubCategoryName)]" />
       	</div>
        <div style="clear:both"></div>
    </div>


     <div class="box">
    	<div class="text">
    	语言对白:
    	</div>
        <div class="input">

<foreach name="Language" key="key" var="var">
<input name="Language" type="radio" value="[$var.Id]" class="radio" checked="checked"/> [$var.Name]
</foreach>
<script language="javascript">$.Input.getRadio('Language','[$MovieInfo.Language]');</script>
       	</div>
        <div style="clear:both"></div>
    </div>

     <div class="box">
    	<div class="text">
    	影片所属地区:
    	</div>
        <div class="input">

<foreach name="Area" key="key" var="var">
<input name="Area" type="radio" value="[$var.Id]" class="radio" checked="checked"/> [$var.Name]
</foreach>
<script language="javascript">$.Input.getRadio('Area','[$MovieInfo.Area]');</script>
       	</div>
        <div style="clear:both"></div>
    </div>


<div class="box">
    	<div class="text">
    	演员列表:
    	</div>
        <div class="input">

<textarea class="textarea" name="Actor" style="width:70%">[@htmlspecialchars($MovieInfo.Actor)]</textarea>

       	</div>
        <div style="clear:both"></div>
    </div>
    
   <div class="box">
    	<div class="text">
    	上映年份:
    	</div>
        <div class="input">
    		<input name="Year" type="text" id="Year" value="[@htmlspecialchars($MovieInfo.Year)]" />
       	</div>
        <div style="clear:both"></div>
    </div>
    
   <div class="box">
    	<div class="text">
    	导演:
    	</div>
        <div class="input">
    		<input name="DireCtor" type="text" class="txt" id="DireCtor" value="[@htmlspecialchars($MovieInfo.DireCtor)]" />
       	</div>
        <div style="clear:both"></div>
    </div>

   <div class="box">
    	<div class="text">
    	连载状态:
    	</div>
        <div class="input">
<select name="PlayDate" id="PlayDate">
    <option value="1">已经完结</option>
    <option value="2">连载中</option>
    <option value="3">不定期连载</option>
</select>
<script language="javascript">$.Input.getSelect('PlayDate','[$MovieInfo.PlayDate]');</script>
       	</div>
        <div style="clear:both"></div>
    </div>


    <div class="box">
    	<div class="text">
    	影片简介:<br /><br />

删除连接：<input type="checkbox" name="Dellink" value="1" checked="checked" />

    	</div>
        <div class="input">
    		      <input type="hidden" id="Content" name="Content" style="display:none" value="[@htmlspecialchars($MovieInfo.Content)]" />
                  <input type="hidden" id="Content___Config" value="" style="display:none" />                 
                   <iframe id="Content___Frame" src="editor/fck/editor/fckeditor.html?InstanceName=Content&amp;Toolbar=Default" width="80%" height="250" frameborder="no" scrolling="no"></iframe>
       	</div>
        <div style="clear:both"></div>
    </div>

      <div class="box">
    	<div class="text">
    	是否为高清电影:
    	</div>
        <div class="input">
    		<input name="IsHD" type="radio" value="1" class="radio" checked="checked"/> 是 <input name="IsHD" type="radio" value="-1" class="radio"/> 不是
            <script language="javascript">$.Input.getRadio('IsHD','[$MovieInfo.IsHD]');</script>
       	</div>
        <div style="clear:both"></div>
    </div>

   <div class="box">
    	<div class="text">
    	所属专题:
    	</div>
        <div class="input">
    		<input name="Special" type="text" class="txt" id="Special" readonly="readonly" onclick="getSpecial();" value="[@htmlspecialchars($MovieInfo.Special)]" />
       	</div>
        <div style="clear:both"></div>
    </div>

      <div class="box">
    	<div class="text">
    	是否为新片:
    	</div>
        <div class="input">
    		<input name="IsNew" type="radio" value="1" class="radio" /> 是 <input name="IsNew" type="radio" value="-1" class="radio" checked="checked"/> 不是
            <script language="javascript">$.Input.getRadio('IsNew','[$MovieInfo.IsNew]');</script>
       	</div>
        <div style="clear:both"></div>
    </div>

    <div class="box">
    	<div class="text">
    	审核状态:
    	</div>
        <div class="input">
    		<select name="State" id="State">
            <option value="1" selected="selected">已审核</option>
            <option value="-1">未审核</option>
            </select>
            <script language="javascript">$.Input.getSelect('State','[$MovieInfo.PlayDate]');</script>
       	</div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
    	<div class="text">
    	首页推荐:
    	</div>
        <div class="input">
    		<select name="IsIndex" id="IsIndex">
            <option value="1">是</option>
            <option value="-1" selected="selected">否</option>
            </select>
            <script language="javascript">$.Input.getSelect('IsIndex','[$MovieInfo.IsIndex]');</script>
       	</div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
    	<div class="text">
    	套红推荐:
    	</div>
        <div class="input">
    		<select name="IsRed" id="IsRed">
            <option value="1">是</option>
            <option value="-1" selected="selected">否</option>
            </select>
             <script language="javascript">$.Input.getSelect('IsRed','[$MovieInfo.IsRed]');</script>
       	</div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
    	<div class="text">
    	关闭评论:
    	</div>
        <div class="input">
    		<select name="IsComment" id="IsComment">
            <option value="1">是</option>
            <option value="-1" selected="selected">否</option>
            </select>
            <script language="javascript">$.Input.getSelect('IsComment','[$MovieInfo.IsComment]');</script>
       	</div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
    	<div class="text">
    	记录更新时间:
    	</div>
        <div class="input">
    		<select name="UpdateDate" id="UpdateDate">
            <option value="1" selected="selected">是</option>
            <option value="-1">否</option>
            </select>
       	</div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
   	  <div class="text">
    	自定义标识::
    	</div>
        <div class="input">
    		<input name="Mark" type="text" id="Mark" value="[@htmlspecialchars($MovieInfo.Mark)]" />
            <br><img src="html/images/information.gif" width="16" height="16" align="absmiddle" /> 用于扩展调用
       	</div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
    	<div class="text">
    	排序:
    	</div>
        <div class="input">
    		<input name="Top" type="text" id="Top" value="[@htmlspecialchars($MovieInfo.Top)]" />
            <br><img src="html/images/information.gif" width="16" height="16" align="absmiddle" /> 数字越大越靠前
       	</div>
        <div style="clear:both"></div>
    </div>
    
    
    <div class="box">
    	<div class="text">
    	点击数:
    	</div>
        <div class="input">
    		<input name="Hits" type="text" id="Hits" value="[@htmlspecialchars($MovieInfo.Hits)]" />
       	</div>
        <div style="clear:both"></div>
    </div>
    <div class="URL_LIST" style="padding-left:10px;">
                <table width="750" class="opt">
                  <tr>
                    <th colspan="3">增加数目:</th>
                  </tr>
                  <tr>
                    <td width="112"><input name="num" type="text" id="num" class="txt" style="width:50px;" value="1" />条</td>
                    <td width="112"><label>
                      <select name="select" id="server">
                        <option value="0">默认服务器</option>
                        <foreach name="ServerList" key="key" var="var"><option value='[$var.Sid]'>[$var.Name]</option></foreach>
                      </select>
                    </label></td>
                    <td width="626" align="left"><input type="button" value="增加" class="btn" onclick="add_line($('num').value)"  style="height:28px;"/>&nbsp;<input type="button" value="1条" class="btn" onclick="add_line(1)"/>&nbsp;<input type="button" value="2条" class="btn" onclick="add_line(2)"/>&nbsp;<input type="button" value="3条" class="btn" onclick="add_line(3)"/>                    </td>
                  </tr>
                  <tr>
                    <th colspan="3">点播列表（点击上面的按钮显示输入框）:<input type="button" value="重新读取播放列表" class="btn" onclick="getMovieList();"/></th>
                  </tr>
                  <tr>
                    <td colspan="3">
            <table border="0" cellspacing="0">
         	<tr>
            <td nowrap="nowrap" style="width:90px;">名称</td>
            <td nowrap="nowrap" style="width:100px;">服务器</td>
            <td nowrap="nowrap" style="width:410px;">地址</td>
            <td nowrap="nowrap" style="width:100px;">排序</td>
            <td nowrap="nowrap" style="width:90px;">删除</td>
          </tr>
		  </table>                    </td>
                  </tr>

                  <tbody>
                  </tbody>
                </table>
           
           <div id="move_list">
           <strong> 正在读取地址，请稍候......</strong>
           <br />
			<img src="html/images/ajax_loader.gif" border="0" />
            <script language="javascript">getMovieList();</script>
          </div>
          
           <table border="0" cellspacing="0" id="property">
         	<tr id=tdt>
            <td nowrap="nowrap"></td>
            <td nowrap="nowrap"></td>
            <td nowrap="nowrap"></td>
            <td nowrap="nowrap"></td>
            <td nowrap="nowrap"></td>
          </tr>
		  </table>         
          
           </td>
                  </tr>

                  <tbody>
                  </tbody>
                </table>
                </div>
    </div>
</div>
<div class="form_box_bottom">
<input type="image" src="html/images/submit.gif" align="absmiddle" border="0" title="保存" id="submit" /></a>
<a href="javascript:history.go(-1);"><img src="html/images/msg_cancel.gif" align="absmiddle" border="0" title="返回上一页" /></a>
</div>
</form>
</body>
</html>
